﻿using BlogDemo.Application;
using Microsoft.Extensions.Configuration;

namespace BlogDemo.Api.Authenticate
{
    public static class AppSettings
    {
        public static TokenConfiguration JwtSetting { get; set; }
        private static IConfiguration _configuration;

        /// <summary>
        /// 初始化jwt配置
        /// </summary>
        /// <param name="configuration"></param>
        public static void Init(IConfiguration configuration)
        {
            _configuration = configuration;
            JwtSetting = new TokenConfiguration();
            _configuration.Bind("TokenConfiguration", JwtSetting);
        }

        public static string GetConnectionString(string name = "defaultContext")
        {
            return _configuration.GetConnectionString(name);
        }
    }
}
